<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/taglib.jsp"%>
<jsp:include page="/WEB-INF/common/head.jsp" flush="true" />
 <div class="easyui-panel addPage" data-options="fit:true,border:false,novalidate:true">
    <form class="easyui-form" id="ff" method="post" data-options="novalidate:true">
        <table class="table1">
        	
            <tr>
           		<th><span>站点名称：</span></th>
               	<td>
               	<input name="oid" type="hidden" value="${oid}"/>
				<div class="wrap_input"><input class="easyui-textbox" type="text" id = "name" name="name" value="${item.name}" data-options="fit:true"></input></div>
           		</td>
           	</tr>

        </table>
    </form>
</div>
	<script type="text/javascript">
		
	top.window.subPage.save = save;
	function save() {
		if($("#ff").form('enableValidation').form('validate')) {
			$.post("${context_path}/sys/site/setSite" , getParam() , function(data) {
				top.window.closeWindow();
				top.window.subPage.loadCurrDatagrid();
			});
		}
	}
	function getParam() {
		var param = {
	       	    "oid": $(":input[name='oid']").val(),
	       	    "siteId": $(":input[name='name']").val()
		}
		for(key in param) {
			if(!param[key]) {
				delete param[key];
			}
		}
		return param;
	}
	
	$(function() {
		//上级菜单
		$.post("${context_path}/sys/site/getAllList", function(data) {
			var menulist = [];
			$.each(data, function(i, item) {
				menulist.push({
					id: item.id,
					text: item.name,
					parent_id: item.parent_id,
				});
			});
			
			for(var i = 0; i < menulist.length; i++) {
				var children = menulist[i].children || [];
				for(var j = 0; j < menulist.length; j++) {
					if(menulist[j].parent_id == menulist[i].id) {
						children.push(menulist[j]);
					}
				}
				menulist[i].children = children;
			}
			var treeData = [];
			$.each(menulist, function(i, item) {
				if(item.parent_id == 0) {
					treeData.push(item);
				}
			});
			$("#name").combotree({
				data: treeData,
				multiple:true
			});
		});
	});
		</script>
  <jsp:include page="/WEB-INF/common/dialogWindow.jsp" flush="true" />
   <jsp:include page="/WEB-INF/common/foot.jsp" flush="true" />
